/*
Solarized theme for code-mirror
http://ethanschoonover.com/solarized
*/

/*
Solarized color pallet
http://ethanschoonover.com/solarized/img/solarized-palette.png
*/
@import "solarized-vars";
@mixin rebase($rebase03,$rebase02,$rebase01,$rebase00,$rebase0,$rebase1,$rebase2,$rebase3)
{
    background-color:$rebase03;
    color:$rebase0;
    * { /* color:$rebase0; */ }
    h1,h2,h3,h4,h5,h6 { color:$rebase1; }
    a, a:active, a:visited { color: $rebase1; }
}

@mixin accentize($accent) {
    a, a:active, a:visited, code.url { color: $accent; }
    h1,h2,h3,h4,h5,h6 {color:$accent}
}
/* light is default mode, so pair with general html definition */
html, .light { @include rebase($base3,$base2,$base1,$base0,$base00,$base01,$base02,$base03)}
.dark  { @include rebase($base03,$base02,$base01,$base00,$base0,$base1,$base2,$base3)}

html * {
    // color-profile: sRGB;
} 
.solarized.base03 { color: $base03; }
.solarized.base02 { color: $base02; }
.solarized.base01 { color: $base01; }
.solarized.base00 { color: $base00; }
.solarized.base0 { color: $base0; }
.solarized.base1 { color: $base1; }
.solarized.base2 { color: $base2; }
.solarized.base3  { color: $base3; }
.solarized.solar-yellow  { color: $yellow; }
.solarized.solar-orange  { color: $orange; }
.solarized.solar-red { color: $red; }
.solarized.solar-magenta { color: $magenta; }
.solarized.solar-violet  { color: $violet; }
.solarized.solar-blue { color: $blue; }
.solarized.solar-cyan { color: $cyan; }
.solarized.solar-green { color: $green; }

/* Color scheme for code-mirror */

.cm-s-solarized {
  line-height: inherit;
}
.cm-s-solarized.cm-s-dark {
  color: $base0;
  background-color: $base03;
  text-shadow: $base03 0 1px;
}
.cm-s-solarized.cm-s-light {
  background-color: $base3;
  color: $base00;
  text-shadow: $base2 0 1px;
  border: 1px solid $base2;
  border-color: #fffcf5 $base2 shade($base2,50%) $base3;
}

.cm-s-solarized .CodeMirror-widget {
  text-shadow: none;
} 

.cm-s-solarized .cm-keyword { color: $orange }
.cm-s-solarized .cm-atom { color: $magenta; }
.cm-s-solarized .cm-number { color: $magenta; }
.cm-s-solarized .cm-def { color: $cyan; }

.cm-s-solarized .cm-variable { color: $blue; }
.cm-s-solarized .cm-variable-2 { color: $yellow; }
.cm-s-solarized .cm-variable-3 { color: $violet; }

.cm-s-solarized .cm-property { color: $cyan; }
.cm-s-solarized .cm-operator {color: $violet;}

.cm-s-solarized .cm-comment { color: $base01; font-style:italic; }

.cm-s-solarized .cm-string { color: $green; }
.cm-s-solarized .cm-string-2 { color: $yellow; }

.cm-s-solarized .cm-meta { color: $green; }
.cm-s-solarized .cm-error,
.cm-s-solarized .cm-invalidchar {
  color: $base01;
  border-bottom: 1px dotted $red;
}
.cm-s-solarized .cm-qualifier { color: $yellow; }
.cm-s-solarized .cm-builtin { color: $magenta; }
.cm-s-solarized .cm-bracket { color: $orange; }
.cm-s-solarized .CodeMirror-matchingbracket { color: $green; }
.cm-s-solarized .CodeMirror-nonmatchingbracket { color: $red; }
.cm-s-solarized .cm-tag { color: $base1; }
.cm-s-solarized .cm-attribute {  color: $cyan; }
.cm-s-solarized .cm-header { color: $base01; }
.cm-s-solarized .cm-quote { color: $base1;; }
.cm-s-solarized .cm-hr {
  color: transparent;
  border-top: 1px solid $base01;
  display: block;
}
.cm-s-solarized .cm-link { color: $base1;; cursor: pointer; }
.cm-s-solarized .cm-special { color: $violet; }
.cm-s-solarized .cm-em {
  color: #999;
  text-decoration: underline;
  text-decoration-style: dotted;
}
.cm-s-solarized .cm-strong { color: #eee; }
.cm-s-solarized .cm-tab:before {
  content: "➤";   /*visualize tab character*/
  color: $base01;
}

.cm-s-solarized.cm-s-dark .CodeMirror-focused .CodeMirror-selected {
  background: #386774;
  color: inherit;
}

.cm-s-solarized.cm-s-dark ::selection {
  background: #386774;
  color: inherit;
}

.cm-s-solarized.cm-s-dark .CodeMirror-selected {
  background: $base01;
}

.cm-s-solarized.cm-s-light .CodeMirror-focused .CodeMirror-selected {
  background: $base2;
  color: inherit;
}

.cm-s-solarized.cm-s-light ::selection {
  background: $base2;
  color: inherit;
}

.cm-s-solarized.cm-s-light .CodeMirror-selected {
  background: $base1;;
} 

/* Editor styling */ 

/* Little shadow on the view-port of the buffer view */
.cm-s-solarized.CodeMirror {
  /* -moz-box-shadow: inset 7px 0 12px -6px #000; */
  /* -webkit-box-shadow: inset 7px 0 12px -6px #000; */
  /* box-shadow: inset 7px 0 12px -6px #000; */
   border-bottom-right-radius: .75rem .5rem; 
  border-bottom-left-radius: .75rem .5rem; 
}

/* Gutter border and some shadow from it  */
.cm-s-solarized .CodeMirror-gutters {
  padding: 0 15px 0 10px;
  /* box-shadow: 0 10px 20px black; */
  border-right: 1px solid;
}

/* Gutter colors and line number styling based of color scheme (dark / light) */

/* Dark */
.cm-s-solarized.cm-s-dark .CodeMirror-gutters {
  background-color: $base02;
  border-color: #00232c;
}

.cm-s-solarized.cm-s-dark .CodeMirror-linenumber {
  text-shadow: #021014 0 -1px;
}

/* Light */
.cm-s-solarized.cm-s-light .CodeMirror-gutters {
  background-color: $base2;
  border-color: $base2;
}

/* Common */
.cm-s-solarized .CodeMirror-linenumber {
  color: $base01;
}

.cm-s-solarized .CodeMirror-gutter .CodeMirror-gutter-text {
  color: $base01;
}

.cm-s-solarized .CodeMirror-lines {
  padding-left: 5px;
}

.cm-s-solarized .CodeMirror-lines .CodeMirror-cursor {
  border-left: 1px solid #819090;
}

/*
Active line. Negative margin compensates left padding of the text in the
view-port
*/
.cm-s-solarized .activeline {
  margin-left: -20px;
}

.cm-s-solarized.cm-s-dark .activeline {
  background: rgba(255, 255, 255, 0.05);

}
.cm-s-solarized.cm-s-light .activeline {
  background: rgba(0, 0, 0, 0.05);
}

/*
View-port and gutter both get little noise background to give it a real feel.
*/
.cm-s-solarized.CodeMirror,
.cm-s-solarized .CodeMirror-gutters {
  background-image: url("");
}
